<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增【请填写功能名称】')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-research-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">序号：</label>
                <div class="col-sm-8">
                    <input name="numbers" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">组织机构：</label>
                <div class="col-sm-8">
                    <input name="organization" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">项目类别：</label>
                <div class="col-sm-8">
                    <input name="category" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">获奖成果名称：</label>
                <div class="col-sm-8">
                    <input name="rname" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">获奖时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="rtime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">获奖类别：</label>
                <div class="col-sm-8">
                    <input name="awardc" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">获奖等级：</label>
                <div class="col-sm-8">
                    <div class="col-sm-8">
                        <select id="aclass" name="aclass" class="form-control" type="text" ></select>
                    </div>
                </div>
            </div>
            <div class="form-group" hidden>
                <label class="col-sm-3 control-label">赋分：</label>
                <div class="col-sm-8">
                    <input name="grade" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group" hidden>
                <label class="col-sm-3 control-label">奖金：</label>
                <div class="col-sm-8">
                    <input name="bonus" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">其他参与人员：</label>
                <div class="col-sm-8">
                    <input name="elses" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group" hidden>
                <label class="col-sm-3 control-label">上传人：</label>
                <div class="col-sm-8">
                    <input name="applyn" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">文件：(doc/pdf)</label>
                <div class="col-sm-8">
                    <input type="hidden" name="accessory">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="accessory" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group" hidden>
                <label class="col-sm-3 control-label">审批状态：</label>
                <div class="col-sm-8">
                    <div class="col-sm-8">
                        <div class="col-sm-8">
                            <input name="status" class="form-control" type="text" value="0">
                        </div>
                </div>
            </div>
            <div class="form-group" hidden>
                <label class="col-sm-3 control-label">备案：</label>
                <div class="col-sm-8">
                    <input name="onRecords" class="form-control" type="text" value="0">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "ruoyi/research"
        $("#form-research-add").validate({
            focusCleanup: true
        });
        score();
        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-research-add').serialize());
            }
        }

        $("input[name='rtime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $(".file-upload").fileinput({
            uploadUrl: '/common/upload',
            maxFileCount: 1,
            autoReplace: true
        }).on('fileuploaded', function (event, data, previewId, index) {
            $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
        }).on('fileremoved', function (event, id, index) {
            $("input[name='" + event.currentTarget.id + "']").val('')
        });


        function score() {
            var a = "请选择获奖等级"
            $.ajax({
                url: prefix + "/score",
                type: "get",
                dataType:"json",
                data: {},
                success: function(data){
                    if(data.length>0){
                        $("#aclass").append("<option>"+ a +"</option>")
                        for(i in data){
                            $("#aclass").append("<option>"+data[i].lvName+"</option>")
                        }
                    }else{
                        $("#aclass").append("<option>暂无数据</option>")
                    }
                },
            })}
    </script>
</body>
</html>